%This function calculates Akaike weights corresponding to m competing models. 
% Input: nxm array AICc values corresponding to m models (n possible repeated optimizations) 
% Output nxm AIC weights
function [wi]=weight_calculator(AIC_array)
for i=1:size(AIC_array,1)%5
li(i,:)=exp(-(AIC_array(i,:)-AIC_array(i,1))/2);
end
sumali=sum(li,2);
for i=1:size(AIC_array,1)
wi(i,:)=li(i,:)./sumali(i);
end
end